package hai.com.android_test.ui;

import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.widget.TextView;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;

import butterknife.BindView;
import butterknife.ButterKnife;
import hai.com.android_test.R;
import hai.com.android_test.widget.calendarView.CalendarView;

public class MainActivity extends FragmentActivity {

    private static final String TAG = "MainActivity";
    @BindView(R.id.calendarView)
    CalendarView calendarView;
    @BindView(R.id.tvDate)
    TextView tvDate;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        ButterKnife.bind(this);
        calendarView.setOnMonthSelectListener(new CalendarView.OnMonthSelectListener() {
            @Override
            public void onMonthSelect(Calendar date) {
                DateFormat dateFormat = new SimpleDateFormat("yyyy/MM");
                tvDate.setText(dateFormat.format(date.getTime()));
            }
        });
    }


}
